package com.itheima.aop;

import org.aspectj.lang.annotation.*;
import org.springframework.stereotype.Component;

/**
 * @author ChaunceyZhang
 * @date 2022-10-17 16:12
 * @blog1 https://zephyr-cyber.github.io/
 * @blog2 https://www.yuque.com/gougougou-xwscx
 */

@Component
@Aspect
public class MyAdvice {
//    @Pointcut("execution(void com.itheima.dao.BookDao.update())")
    @Pointcut("execution(* com.itheima.*.*.u*(..))")
    public void pt2(){}

    @Before("pt2()")
    public void beforeLog() {
        System.out.println("方法开始了~~");

    }

    @After("pt2()")
    public void afterLog(){
        System.out.println("方法结束了~~~");
    }

    @AfterThrowing("pt2()")
    public void exLog(){
        System.out.println("方法出异常了~~~");
    }

}
